var WebTorrent = require('webtorrent')

var client = new WebTorrent()

var magnetURI = 'magnet:...'

client.add('magnet:?xt=urn:btih:9036216826bd022065fa158abeb8e48b48918710&dn=pmy.mp4&tr=udp%3A%2F%2Fexodus.desync.com%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=wss%3A%2F%2Ftracker.btorrent.xyz&tr=wss%3A%2F%2Ftracker.fastcast.nz&tr=wss%3A%2F%2Ftracker.openwebtorrent.com&tr=wss%3A%2F%2Ftracker.webtorrent.io ', { path: '/webtorrent' }, function (torrent) {
  console.log(torrent)
  torrent.on('done', function () {
    console.log('torrent download finished')
  })
  torrent.on('error', function (err) {
  	console.log(err)
  })
})

client.on('warning', function (err) {
	console.log(err)
})
client.on('error', function (err) {
	console.log(err)
})